package com.kuang.dao;

import com.kuang.mapper.DepartmentMapper;
import com.kuang.pojo.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author WZT
 * @create 2021-05-31 15:38
 */
@Repository
public class DepartmentDao {
    //    //模拟数据库中的数据
//    private static Map<Integer, Department> departments = null;
//    static {
//        departments = new HashMap<Integer, Department>();
//
//        departments.put(101,new Department(101,"教学部"));
//        departments.put(102,new Department(102,"市场部"));
//        departments.put(103,new Department(103,"教研部"));
//        departments.put(104,new Department(104,"运营部"));
//        departments.put(105,new Department(105,"后勤部"));
//        departments.put(106,new Department(106,"记者部"));
//    }
    @Autowired
    DepartmentMapper departmentMapper;

    //所有部门的信息
    public Collection<Department> getDepartments() {
        return departmentMapper.getDepartments();
    }

    //通过id得到部门
    public Department getDepartmentById(Integer id) {
        return departmentMapper.getDepartment(id);
    }
}
